import request from '@/api/request.js'

// 左侧属性结构
export const getColumnTree = (params) => {
  return request({
    url: `/channel/v_tree?root=${params.root}&userId=${params.userId}`,
    method: 'GET'
  })
}

// 右侧列表
export const getColumnList = (params) => {
  return request({
    url: `/channel/v_list?root=${params.root}&pageNo=${params.pageNo}&pageSize=${params.pageSize}`,
    method: 'GET'
  })
}
// 添加子栏目菜单栏
export const getchildColumnList = () => {
  return request({
    url: '/channel/o_addModel',
    method: 'POST'
  })
}

// 删除某个栏目信息
export const deleteColumn = (params) => {
  return request({
    url: `/channel/o_delete?ids=${params.ids}&root=${params.root}&userId=${params.userId}`,
    method: 'POST'
  })
}

// 添加子栏目
export const createChildColumn = (data) => {
  return request({
    url: '/channel/o_save',
    method: 'POST',
    data
  })
}
// 根据子栏目动态渲染组件

export const childColumn = (params) => {
  return request({
    url: `/channel/o_resultModel?modelId=${params.id}`,
    method: 'POST'
  })
}

// 根据id查相应数据
export const IdColumnList = (params) => {
  return request({
    url: '/channel/v_edit',
    method: 'GET',
    params
  })
}
// 修改栏目
export const updateColumn = (data) => {
  return request({
    url: '/channel/o_update',
    method: 'POST',
    data
  })
}
